﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SIPO.Library.DataAccess.Administration;
using SIPO.Library.DomainObject.Administration;
using System.Configuration;

namespace SIPO.Web.Forms.Administration
{
    public partial class sLogform : BasePage
    {
        private int id = -1;

        protected override void OnLoad(EventArgs e)
        {
            if (Request.Params["Id"] != null)
            {
                id = Convert.ToInt32(Request.Params["Id"]);
            }

            if (!Page.IsPostBack)
            {
                if (id > 0) // Edit an existing item
                {
                    recLogRepo logDal = new recLogRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
                    recLog dto = logDal.GetById(id);
                    if (dto != null)
                    {
                        hfID.Value = id.ToString();

                        txtEvent.Text = dto.LogEvent;
                        txtMessage.Text = dto.LogMessage;
                        txtSource.Text = dto.LogSource;
                        txtTgl.Text = dto.CreatedDate.Value.ToString("dd/MM/yyyy");
                    }
                }
            }
        }


    }

}